<template>
	<view class="page background-image">
		<page-head :title="title"></page-head>
		<view class="uni-product-list">
			<view class="uni-product" v-for="(product,index) in productList" :key="index" @click="handleClick(index)">
				<view class="image-view">
					<image v-if="renderImage" class="uni-product-image" :src="product.image"></image>
				</view>
				<view class="uni-product-title" style="text-align: center;font-size: 20px;">{{product.title}}</view>
			</view>
		</view>
	</view>
</template>
<script>
export default {
    data() {
        return {
            title: '综合部门',
			productList: [],
            renderImage: false
        };
    },
    methods: {
        loadData(action = 'add') {
            const data = [
                {
                    image: 'http://www.hngsxy.com/projectresources/wxapp/dept/dept1.png',
                    title: '党政办公室'
                },
                {
                    image: 'http://www.hngsxy.com/projectresources/wxapp/dept/dept2.png',
                    title: '组织人事处'
                },
                {
                    image: 'http://www.hngsxy.com/projectresources/wxapp/dept/dept3.png',
                    title: '学生工作处'
                },
                {
                    image: 'http://www.hngsxy.com/projectresources/wxapp/dept/dept4.png',
                    title: '科研处'
                },
                // {
                //     image: '../../static/deptImg/sxy_img.png',
                //     title: '财务处'
                // },
                {
                    image: 'http://www.hngsxy.com/projectresources/wxapp/dept/dept6.png',
                    title: '招生处'
                },
                {
                    image: 'http://www.hngsxy.com/projectresources/wxapp/dept/dept7.png',
                    title: '就业处'
                },
                {
                    image: 'http://www.hngsxy.com/projectresources/wxapp/dept/dept8.png',
                    title: '安全保卫处'
                },
                {
                    image: 'http://www.hngsxy.com/projectresources/wxapp/dept/dept9.png',
                    title: '实训中心'
                },
                {
                    image: 'http://www.hngsxy.com/projectresources/wxapp/dept/dept10.png',
                    title: '督导室'
                },
                {
                    image: 'http://www.hngsxy.com/projectresources/wxapp/dept/dept11.png',
                    title: '后勤处'
                }
            ]
            if (action === 'refresh') {
                this.productList = []
            }

            data.forEach(item => {
                this.productList.push(item)
            });
        },
		handleClick(i){
			if (i === 0){
				uni.navigateTo({
					url: '/pages_bd/video_notice_new/gir_new?newsType=DZBGS1,DZBGS2,DZBGS3,DZBGS4,DZBGS5,DZBGS6,DZBGS7,DZBGS8,DZBGS9,DZBGS10,DZBGS11,DZBGS12,DZBGS13,DZBGS14,DZBGS15,DZBGS16,DZBGS17,DZBGS18&name=党政办公室'
				})
			} else if(i === 1) {
				uni.navigateTo({
					url: '/pages_bd/video_notice_new/gir_new?newsType=10,11,12,13,14,15,16,17,18&name=组织人事处'
				})
			} else if(i === 2) {
				uni.navigateTo({
					url: '/pages_bd/video_notice_new/gir_new?newsType=XSGZC1,XSGZC2,XSGZC3,XSGZC4,XSGZC5,XSGZC6,XSGZC7,XSGZC8,XSGZC9,XSGZC10,XSGZC11,XSGZC12,XSGZC13&name=学生工作处'
				})
			} else if(i === 3) {
				uni.navigateTo({
					url: '/pages_bd/video_notice_new/gir_new?newsType=KYC1,KYC2,KYC3,KYC4,KYC5,KYC6,KYC7,KYC8,KYC9&name=科研处'
				})
			}
			//  else if(i === 4) {
			// 	uni.navigateTo({
			// 		url: '../video_notice_new/gir_new?newsType=CWC1,CWC2,CWC3,CWC4,CWC5,CWC6,CWC7&name=财务处'
			// 	})
			// }
			 else if(i === 4) {
				uni.navigateTo({
					url: '/pages_bd/video_notice_new/gir_new?newsType=ZSW1,ZSW2,ZSW3,ZSW4,ZSW5,ZSW6,ZSW7,ZSW8,ZSW9,ZSW10,ZSW11,ZSW12,ZSW13,ZSW14,ZSW15,ZSW16,ZSW17&name=招生处'
				})
			} else if(i === 5) {
				uni.navigateTo({
					url: '/pages_bd/video_notice_new/gir_new?newsType=120,121,122,123,124,125,126,127,128,129&name=就业处'
				})
			} else if(i === 6) {
				uni.navigateTo({
					url: '/pages_bd/video_notice_new/gir_new?newsType=BWC1,BWC2,BWC3,BWC4,BWC5,BWC6,BWC7,BWC8,BWC9&name=安全保卫处'
				})
			} else if(i === 7) {
				uni.navigateTo({
					url: '/pages_bd/video_notice_new/gir_new?newsType=SXZX1,SXZX2,SXZX3,SXZX4,SXZX5,SXZX6,SXZX7&name=实训中心'
				})
			} else if(i === 8) {
				uni.navigateTo({
					url: '/pages_bd/video_notice_new/gir_new?newsType=DDS1,DDS2,DDS3,DDS4,DDS5,DDS6,DDS7,DDS8,DDS9&name=督导室'
				})
			} else if(i === 9) {
				uni.navigateTo({
					url: '/pages_bd/video_notice_new/gir_new?newsType=HQC1,HQC2,HQC3,HQC4,HQC5&name=后勤处'
				})
			}
		}
    },
    onLoad() {
        this.loadData();
        setTimeout(()=> {
            this.renderImage = true
        }, 300)
    }
};
</script>

<style>
	.background-image {  
 	    width: 100%;
	    
	    background-image: url('https://mp-7c5f2fa7-1d2c-41f1-b3dd-1f45e490fd36.cdn.bspapp.com/2024/08/22/98155444-22982919-111222.jpg'); /* 替换为你的图片URL */  
	    background-size: cover; /* 使图片覆盖整个div，不保持宽高比 */  
	    /* 或者使用 background-size: contain; 保持宽高比，图片可能无法完全覆盖div */  
	    background-position: center; /* 图片居中显示 */  
	    background-repeat: no-repeat; /* 不重复图片 */  
	}
</style>
